package hgx.spring.cloud.lession.myhystrix;/**
 * Created by liujun on 2018/4/19.
 */

import java.util.List;

import hgx.spring.cloud.lession.productrepertory.dao.ProductDaoImpl;
import hgx.spring.cloud.lession.productrepertory.vo.ProductVo;

/**
 * @author Administrator
 * @create 2018-04-19 14:28
 */
public class MyRequest {
    private ProductDaoImpl productDao;

    public MyRequest(ProductDaoImpl productDao) {
        this.productDao = productDao;
    }

    /**
     * 查询所有产品数据
     * @return
     */
    public List<ProductVo> findAll(){
        List<ProductVo>  result = productDao.findAll();
      return result;
    }

    /**
     * 根据产品ID 获取产品
     * @param id
     * @return
     */
    public ProductVo getProductById(Long id){
        ProductVo productVo=productDao.getProductById(id);
        return productVo;
    }

    /**
     * 创建产品
     * @param productVo
     * @return
     */
    public boolean createProductVo(ProductVo productVo){
        boolean flag=productDao.createPorduct(productVo);

        return flag;
    }



}
